package cn.tjie.basic.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 增删改返回给前端的工具类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    //响应给前端用户判断
    private Object obj;
    //响应给前端字符串信息
    private Boolean success = true;
    //响应给前端任意类型的数据 - fastDfs
    private String msg = "操作成功";

    public AjaxResult(Boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }
    //链式语法的改造
    public static AjaxResult me(){
        return new AjaxResult();
    }
    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }
    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }
    public AjaxResult setObj(Object obj) {
        this.obj = obj;
        return this;
    }
}
